/**
 * WebView样式表
 * 为VSCode WebView界面提供样式
 * 
 * @author lihengtt <lihengsir@gmail.com>
 * @github https://github.com/lihengtt
 */

:root {
    --container-padding: 10px;
    --input-padding-vertical: 6px;
    --input-padding-horizontal: 8px;
    --input-margin-vertical: 4px;
    --input-margin-horizontal: 0;
}

body {
    padding: 0;
    margin: 0;
    color: var(--vscode-foreground);
    font-size: 13px;
    font-family: var(--vscode-font-family);
}

.container {
    padding: var(--container-padding);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 配置区域 */
.config-section {
    margin-bottom: 10px;
    padding: 8px;
    background-color: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 4px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.config-status {
    padding: 4px 0;
}

.config-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 控制区域 */
.control-section {
    margin-bottom: 10px;
}

.control-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 路径导航 */
.path-section {
    margin-bottom: 10px;
    padding: 8px;
    background-color: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 4px;
}

.path-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.path-controls {
    display: flex;
    gap: 4px;
}

.btn-nav {
    padding: 4px 8px;
    font-size: 14px;
    min-width: auto;
    background-color: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    border: 1px solid var(--vscode-panel-border);
}

.btn-nav:hover:not(:disabled) {
    background-color: var(--vscode-button-secondaryHoverBackground);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.path-label {
    font-weight: 600;
    white-space: nowrap;
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    min-width: 0;
}

.breadcrumb-item {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    white-space: nowrap;
    color: var(--vscode-textLink-foreground);
}

.breadcrumb-item:hover {
    background-color: var(--vscode-list-hoverBackground);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--vscode-descriptionForeground);
    font-size: 12px;
}

.current-path {
    word-break: break-all;
}

/* 文件列表 */
.files-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    padding: 8px;
    background-color: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 4px;
}

.files-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
}

.file-item:hover {
    background-color: var(--vscode-list-hoverBackground);
}

.file-icon {
    margin-right: 8px;
    font-size: 16px;
}

.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-action {
    padding: 2px 4px;
    font-size: 12px;
    background: none;
    border: none;
    color: var(--vscode-button-foreground);
    cursor: pointer;
    border-radius: 2px;
}

.file-action:hover {
    background-color: var(--vscode-button-hoverBackground);
}

/* 状态栏 */
.status-section {
    padding: 4px 8px;
    background-color: var(--vscode-statusBar-background);
    color: var(--vscode-statusBar-foreground);
    border-radius: 4px;
}

/* 按钮样式 */
.btn {
    padding: var(--input-padding-vertical) var(--input-padding-horizontal);
    border: none;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    border-radius: 2px;
    min-width: 70px;
}

.btn-primary {
    background-color: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
}

.btn-primary:hover {
    background-color: var(--vscode-button-hoverBackground);
}

.btn-secondary {
    background-color: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
}

.btn-secondary:hover {
    background-color: var(--vscode-button-secondaryHoverBackground);
}

.btn-success {
    background-color: var(--vscode-statusBarItem-prominentBackground);
    color: var(--vscode-statusBarItem-prominentForeground);
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-info {
    background-color: var(--vscode-editor-infoForeground);
    color: white;
}

.btn-info:hover {
    opacity: 0.9;
}

.btn-toggle {
    background-color: var(--vscode-checkbox-background);
    color: var(--vscode-checkbox-foreground);
}

.btn-toggle.active {
    background-color: var(--vscode-statusBarItem-prominentBackground);
    color: var(--vscode-statusBarItem-prominentForeground);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--vscode-descriptionForeground);
}

/* 错误消息 */
.error-message {
    color: var(--vscode-errorForeground);
    padding: 10px;
    text-align: center;
}

/* 目录路径导航 */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-bottom: 8px;
}

.breadcrumb-item {
    cursor: pointer;
    color: var(--vscode-textLink-foreground);
}

.breadcrumb-separator {
    color: var(--vscode-descriptionForeground);
}

/* 对话框 */
.dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog {
    background-color: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 4px;
    padding: 16px;
    min-width: 300px;
    max-width: 90%;
}

.dialog-header {
    margin-bottom: 16px;
}

.dialog-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dialog-body {
    margin-bottom: 16px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 表单控件 */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: var(--input-padding-vertical) var(--input-padding-horizontal);
    background-color: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
    border: 1px solid var(--vscode-input-border);
    border-radius: 2px;
}

.form-control:focus {
    outline: 1px solid var(--vscode-focusBorder);
    border-color: var(--vscode-focusBorder);
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: var(--vscode-editorHoverWidget-background);
    color: var(--vscode-editorHoverWidget-foreground);
    text-align: center;
    border-radius: 4px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--vscode-editorHoverWidget-border);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}